Cevela about COBOL COBOL language - Home - Site Map - About Cevela - MX COBOL    <prev   next>
1.   Source program structure and language fundamentals
For more see links to the main provider's on-line documentation.
For MX COBOL see Summary comment + FAQ and How to ..

Common structure of the source program in COBOL - selected

                                                                   02-1
[identification division.]
[program-id.
    Prog-1 ..]
..

[environment division. file-control. select File-2 ..

[data division.] file section. file-spec* .. working-storage section. data-spec* .. linkage-section. data-spec* .. report section. report-spec* .. screen section. screen-spec* ..

procedure division using Dat-3 ... . [declaratives. declar-section* .. end declaratives.] Proc-3 [section] . statements* .. ...


Remarks: - all headers except procedure division are not obligatory (if not used) - there are other sections and paragraphs in the COBOL-02 and different dialects - for main new concepts see news MX limitations: declaratives are not functional

Cobol words

                                                                 60-1
text-character words*
   cobol-reserved-words*
      XXYYZZ, XxYyZz, xxyyzz, xx-yy-zz, (max 30 chars with hyphens)
      eg. move, perform, to, working-storage, tally, ... etc.

programmer's names* format see above label name in Proc-div can be integer or can begin with it eg. F-1, END-INP, OLD-ACCOUNT, New-account ... etc

intrinsic function names and other system ones*


MX limitations: ntrincic functions are not implemented

                                                                 60-1
spec-char words*
   arithmetic operators*
      +  -  *  /  **  =

relational operators* > < = >= <=

other spec-charwords* new in COBOL-02

                                                                 60-1
level numbers*
    1-9,  01-49,  66,  77,  88, 

Remarks: in MF COBOL there is another level 78 for constants

Programmer's names

Abc-1
   alphabet
Char-1
   one character LitX-1
Cond-1
   condition name
Dat-1
   data item
Dat9-1
   elementary numeric data item
DatG-1
   group data item
DatI-1
   elementary index data item
DatR-1
   report data item
DatX-1
   elementary alphanumeric data item
Dev-1
   device name
File-1
   file
FileS-1
   file status
Ind-1
   special index
Int-1
   integer number (include 0 and signed negative)
Lit-1
   literal
Lit9-1
   numeric literal [sign, decimal point]
LitX-1
   alphanumeric literal, all literal, fig-constant
Num-1
   natural number (Int > 0)
Proc-1
   procedure section, paragraph
Prog-1
   program, subprogram
Rec-1
   record data item
Rep-1
   report
Screen-1
   screen (DatG-1 within screen section)
    

Separators and Indicators

                                                                 60-1
separators-indicators*
   cobol word's separators*
      space[s]  ,space  ;space  .space  (  )

literal delimiters* " ' # - "- '-

directive and debugging indicators* D d

Pic-string symbols

                                                                 60-1
pic-string symbols*
   pic data categories*
      A  a  X  x  N  n  9 

pic sign and decimal point* S s V v P p

pic floating editing* * Z z + - $

pic fix editing* B b 0 / . , + - DB Db db CR Cr cr

pic floating point* E e


Remarks: in COBOL-02 there are some other new symbols

Literals

                                                                 60-1
literals*
   numeric constants*

non numeric (alphanumeric) character strings*

hexadecimal strings*

external names*

system library routine names*

Comment indicators

                                                                 60-1
comment indicators*
   *  &
Remark:
   indicator & is implemented in MX only
    

Remark: there are only selected qualities in paragraphs above

COBOL language in brief - © Vlastimil Cevela 2006

Date 2006-06-03 - Text Builder 0.65 - Time 20:31:22